package it.fc.service.db.manager;

import fc.utils.HibernateUtil;
import it.fc.utils.singleton.ServiceLocator;

import java.sql.Connection;

import org.apache.log4j.Logger;
import org.hibernate.SessionFactory;

//padre dei manager (biat a iss)

public class DbManager {
    private static Logger log  = Logger.getLogger(DbManager.class);

    private Connection    conn = null;

    protected Connection getConnection() {

        Connection conn = null;

        try {
            conn = ServiceLocator.lookup().getConnection();
        } catch (Exception ex1) {
            log.error("Errore nella creazione della connessione");
            ex1.printStackTrace();
        }
        return conn;
    }
    
    /**
     * Hibernate wrap
     * 
     * @return Session Hibernate
     */
    
    protected SessionFactory getSessionFactory(){
        return HibernateUtil.getSessionFactory();
    }

}
